package com.yunji.cabinet.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yunji.cabinet.dao.IMaintainDao;
import com.yunji.cabinet.domain.MaintainDO;
import com.yunji.cabinet.mapper.IMaintainMapper;
import com.yunji.cabinet.params.RecordParam;
import com.yunji.cabinet.vo.MaintainVO;
import com.yunji.common.base.BaseDaoImpl;
import com.yunji.common.utils.bean.BeanUtils;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.cabinet.dao.impl
 * @Title: MaintainDaoImpl
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-11-01 14:55:46      V1.0        HuaAo       新建类
 */
@Repository
public class MaintainDaoImpl extends BaseDaoImpl<IMaintainMapper, MaintainDO> implements IMaintainDao {

    @Override
    public MaintainDO select(MaintainDO maintain) {
        return getOne(new LambdaQueryWrapper<MaintainDO>()
                .eq(BeanUtils.isNotNull(maintain.getContainerId()), MaintainDO::getContainerId, maintain.getContainerId())
                .eq(BeanUtils.isNotNull(maintain.getMaintainCode()), MaintainDO::getMaintainCode, maintain.getMaintainCode())
                .eq(BeanUtils.isNotNull(maintain.getMaintainType()), MaintainDO::getMaintainType, maintain.getMaintainType())
                .eq(BeanUtils.isNotNull(maintain.getMaintainStatus()), MaintainDO::getMaintainStatus, maintain.getMaintainStatus()));
    }

    @Override
    public List<MaintainVO> searchPageList(RecordParam param) {
        return baseMapper.searchPageList(param);
    }

    @Override
    public String getImeiByMaintainCode(String maintainCode) {
        return baseMapper.getImeiByMaintainCode(maintainCode);
    }
}